|
|
|
|
|
|
|
The scope of a variable determines which routines are allowed to view or change its value. If you declare a variable in an event procedure using the Dim statement, that variable is visible only to that procedure. Furthermore, when the event procedure ends, that variables value is discarded. |
|
|
|
|
|
|
|
|
Variables declared with the Dim statement are allocated on the stack when the procedure is entered. The stack is a temporary area of memory, and the stack thats allocated for a procedure is discarded when the procedure exits, meaning that the contents of all local variables are discarded. |
|
|
|
|
|
|
|
|
Examples Filename: VarExamples.frm |
|
|
|
|
|
|
|
|
The form shown in Figure 6.2 will be used to demonstrate the various variable declaration types. |
|
|
|
|
|
|
|
|
Figure 6.2
Examples of variables. |
|
|
|
|
| Load the Sample Project for This Chapter 1. Load the sample project that goes with this chapter. 2. Run the first sample to follow along. |  | If you load the sample for this chapter it may help you follow the logic for this narration. |
|
|
|